<!DOCTYPE html>
<html lang="zh_CN">

<head>
    <meta charset="UTF-8">
    <title>用户登录 - {$setting['name']}</title>
    {load href="/static/css/zui.min.css"}
    {load href="/static/css/zui-theme.css"}
    {load href="/static/login.css"}
    <script type="text/javascript">
        var base_url = "{:url('@admin')}";
    </script>
</head>

<body>
    <form action="{:url('@admin/login/dologin')}" method="post" class="form-horizontal" id="form-user-dologin">
        <div class="modal" data-backdrop="static" data-keyboard="false" id="login">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-body">
                        <h2 class="modal-title text-center">用户登录</h2>
                        <hr>
                        <div class="form-group">
                            <label for="login_username" class="col-xs-3 required">登录账号</label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" name="login_username" id="login_username" placeholder="登录账号" minlength="5" maxlength="25" autocomplete="off" value="{$username}" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="login_password" class="col-xs-3 required">登录密码</label>
                            <div class="col-xs-8">
                                <input type="password" class="form-control" name="login_password" id="login_password" autocomplete="new-password" placeholder="登录密码" value="{$password}" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-8 col-sm-offset-3">
                                <div class="checkbox-primary"><input type="checkbox" name="login_remember" id="login_remember" value="true" {$remember?'checked':''}><label for="login_remember">记住登录状态</label></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-4 col-sm-offset-2">
                                <button type="button" class="btn btn-warning btn-block" id="goto_forget">忘记密码</button>
                            </div>
                            <div class="col-xs-4">
                                <button type="submit" class="btn btn-success btn-block">登录系统</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <form action="{:url('@admin/login/doforget')}" method="post" class="form-horizontal" id="form-user-forget">
        <div class="modal" data-backdrop="static" data-keyboard="false" id="forget">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-body">
                        <h2 class="modal-title text-center">忘记密码</h2>
                        <hr>
                        <div class="form-group">
                            <label for="forget_username" class="col-sm-3 required">手机/邮箱</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="forget_username" id="forget_username" autocomplete="off" placeholder="手机/邮箱"  required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="forget_password" class="col-sm-3 required">验证码</label>
                            <div class="col-sm-4 pr0">
                                <input type="text" class="form-control" name="forget_code" id="forget_code" placeholder="验证码" maxlength="4" required>
                            </div>
                            <div class="col-sm-4"><img src="{:url('@admin/login/verify')}" alt="captcha" id="captcha" class="captcha"></div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12 text-center">
                                <p class="form-control-static">忘记帐号信息，请联系网站管理员！</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-warning btn-block" id="goto_login">系统登录</button>
                            </div>
                            <div class="col-sm-4">
                                <button type="submit" class="btn btn-success btn-block">重置密码</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>


    {load href="/static/lib/jquery/jquery.js"}
    {load href="/static/lib/jquery/jquery.form.js"}
    {load href="/static/lib/validator/validator.min.js"}
    {load href="/static/js/zui.min.js"}
    {load href="/static/app.js"}
    <script type="text/javascript">
    $(document).ready(function() {
        $("#login").modal('show');
        $("#goto_forget").click(function(event) {
            $("#login").modal('hide');
            $("#forget").modal('show');
        });
        $("#goto_login").click(function(event) {
            $("#forget").modal('hide');
            $("#login").modal('show');
        });
        $("#captcha").click(function(event) {
            $(this).attr('src', "{:url('@admin/login/verify')}?"+Math.random());
        });
        $('form#form-user-dologin').validator().on('submit', function(e) {
            if (e.isDefaultPrevented()) {
                return false;
            }
            // 使用jquery.form.js插件提交
            $('#form-user-dologin').ajaxSubmit({
                beforeSubmit: sxj.loading,
                success: sxj.msg_thinkphp
            });
            return false;
        });
        $('form#form-user-forget').validator().on('submit', function(e) {
            if (e.isDefaultPrevented()) {
                return false;
            }
            // 使用jquery.form.js插件提交
            $('#form-user-forget').ajaxSubmit({
                beforeSubmit: sxj.loading,
                success: sxj.msg_thinkphp
            });
            return false;
        });
    });
    </script>
</body>

</html>